﻿using System;
using System.Collections.Generic;
using StockholmsStad.Runtime.Serialization.DataContract;
using StockholmsStad.Runtime.Serialization.DataContract.Enums;

namespace StockholmsStad.Data.Test
{
    public class TestEntity
    {
        public const string ExistingLanguage = "Svenska";
        public const string ExistingSpecialNeed = "Rullstol";
        public const string NewCeremonyType = "Ovanlig";
        public const string NewLanguage = "NewLanguageName";

        public static ValueIdPair GetNewCeremonyLanguage()
        {
            return new ValueIdPair() {Name = "NewCeremonyLanguage"};
        }

        public static ValueIdPair GetNewCertificateLanguage()
        {
            return new ValueIdPair() { Name = "NewCertificateLanguageName" };
        }

        public static ValueIdPair GetSpecialNeed()
        {
            return new ValueIdPair { Name = "NyttHjälpMedel" };
        }

        public static ValueIdPair GetSpecialNeed1()
        {
            return new ValueIdPair { Name = "NyttHjälpMedel1" };
        }

        public static ValueIdPair GetSpecialNeed2()
        {
            return new ValueIdPair { Name = "NyttHjälpMedel2" };
        }

        public static Address GetNewAddress()
        {
            return new Address
                       {
                           StreetAddress = "StreetAddress",
                           City = "City",
                           Country = "Country",
                           CoAddress = "COAddress",
                           PostCode = "postcode"
                       };
        }

        public static ReportDefinition GetReportDefinition()
        {
            return new ReportDefinition
                       {
                           AboveDate = "AboveDate",
                           BelowDate = "BelowDate",
                           BelowSignature = "BelowSignature",
                           BetweenNames = "BetweenNames",
                           City = "City",
                           Heading = "Heading",
                           Inception = "Inception",
                           SignLine = "SignLine",
                       };
        }

        public static ReportDefinition GetReportDefinitionWithSomeNullValues()
        {
            return new ReportDefinition
            {
                BelowSignature = "BelowSignature",
                BetweenNames = "BetweenNames",
                City = "City",
                Heading = "Heading",
                Inception = "Inception",
                SignLine = "SignLine",
            };
        }

        public static ParvisUser GetParvisUserWithCellPhone()
        {
            return new ParvisUser
                       {
                           FirstName = "Firstnames",
                           LastName = "Lastname",
                           CellPhoneNumber = "CellPhoneNr",
                           PhoneNumber = "PhoneNr",
                           Username = "parvistest@input.nu",
                           Role = UserRole.HandlingOfficer,
                       };
        }

        public static ParvisUser GetParvisUserWithoutCellPhone()
        {
            return new ParvisUser
            {
                FirstName = "Firstnames",
                LastName = "Lastname",
                PhoneNumber = "PhoneNr",
                Username = "parvistest@input.nu",
                Role = UserRole.HandlingOfficer,
            };
        }

        public static Person GetNewPerson1()
        {
            return new Person
                       {
                           FirstNames = "Firstnames",
                           LastName = "Lastname",
                           PersonalNumber = "PersonalNo",
                           ProtectedIdentity = false,
                           Sex = Sex.Male,
                           Address = GetNewAddress(),
                           SwedishNationality = true,
                           PhoneNumber = "Phonenumber",
                           Email = "new@person.se",
                           //Representative = false,
                       };
        }

        public static Person GetNewPerson2()
        {
            return new Person
                       {
                           FirstNames = "Firstnames2",
                           LastName = "Lastname2",
                           Nationality = "Nationality2",
                           PersonalNumber = "PersonalNo2",
                           ProtectedIdentity = false,
                           SwedishNationality = true,
                           Sex = Sex.Female
                       };
        }

        public static Person GetNewPerson2WithProtectedIdentity()
        {
            return new Person
            {
                FirstNames = "Firstnames2",
                LastName = "Lastname2",
                Nationality = "Nationality2",
                ProtectedIdentity = true,
                Sex = Sex.Female
            };
        }

        public static ContactPerson GetNewContactPerson()
        {
            return new ContactPerson
                       {
                           Email = "contact@emailaddress",
                           FirstNames = "FirstnamesContact",
                           LastName = "LastnameContact",
                           Telephone = "PhonenumberContact"
                       };
        }

        public static ContactPerson GetNewContactPersonWithoutPhone()
        {
            return new ContactPerson
                       {
                           Email = "contact@emailaddress",
                           FirstNames = "FirstnamesContact",
                           LastName = "LastnameContact",
                       };
        }

        public static Couple GetNewCoupleWithContact()
        {
            return new Couple
                       {
                           Person1 = GetNewPerson1(),
                           Person2 = GetNewPerson2(),
                           ContactPerson = GetNewContactPerson()
                       };
        }

        public static Couple GetNewCoupleWithoutContact()
        {
            return new Couple
                       {
                           Person1 = GetNewPerson1(),
                           Person2 = GetNewPerson2(),
                       };
        }

        public static Ceremony GetNewCeremony()
        {
            return new Ceremony
                       {
                           CeremonyLanguage = new ValueIdPair {Name = NewLanguage},
                           CertificateLanguage = new ValueIdPair {Name = NewLanguage},
                           Interpreter = false,
                           Note = "en liten notering",
                       };
        }

        public static Ceremony GetNewCeremonyWithImpedimentDates()
        {
            return new Ceremony
            {
                CeremonyLanguage = new ValueIdPair { Name = NewLanguage },
                CertificateLanguage = new ValueIdPair { Name = NewLanguage },
                Interpreter = false,
                Note = "en liten notering",
                ImpedimentDocIssuedDate = DateTime.Now,
                ImpedimentDocAllowDelayDays = 5,
            };
        }

        public static Ticket GetNewIssue()
        {
            return new Ticket
                       {
                           Ceremony = GetNewCeremony(),
                           Couple = GetNewCoupleWithContact()
                       };
        }


        public static User GetNewUser()
        {
            return new User {Username = "parvistestproject@test.nu", Password = "testproject", Role = UserRole.Customer};
        }


        public static User GetNewUserWithoutUserName()
        {
            return new User();
        }

        public static Booking GetIndividualBooking()
        {
            return new Booking()
                       {
                           MinisterCode = GetNewMinister().MinisterCode,
                           CeremonyType = CeremonyType.Individual,
                           DateTime = new TimeBlock() {StartDateTime = new DateTime(2009, 03, 11)},
                           PreferredDate1 = null,
                           PreferredDate2 = null,
                       };
        }

        public static Minister GetNewMinister()
        {
            return new Minister
                       {
                           MinisterCode = "testprojectministercode",
                           FirstNames = "Pelle",
                           LastName = "Ohlsson",
                           Email = "hallon@hallon.se",
                           Note = "här noterar vi",
                           PhoneNumber = "231232423",
                           CellPhoneNumber = "0733 519 400",
                           SpecialAssignment = false,
                           // Ser till att förrättaren är aktiv
                           AssignmentStartDate = DateTime.Now.AddDays(-25),
                           AssignmentEndDate = DateTime.Now.AddDays(25),
                           Address = new Address
                                         {
                                             StreetAddress = "hallonvägen",
                                             City = "hallonstaden",
                                             Country = "bärland",
                                             PostCode = "1111",
                                             CoAddress = "",
                                         },
                           Languages = new List<string> {"Svenska", "Engelska"},
                       };
        }

        public static Minister GetNewMinisterWithNewLanguage()
        {
            return new Minister
                       {
                           MinisterCode = "Gurka4343434344321",
                           FirstNames = "Pelle",
                           LastName = "Ohlsson",
                           Email = "hallon@hallon.se",
                           Note = "här noterar vi",
                           PhoneNumber = "231232423",
                           CellPhoneNumber = "0733 519 400",
                           SpecialAssignment = false,
                           // Ser till att förrättaren är aktiv
                           AssignmentStartDate = DateTime.Now.AddDays(-25),
                           AssignmentEndDate = DateTime.Now.AddDays(25),
                           Address = new Address
                                         {
                                             StreetAddress = "hallonvägen",
                                             City = "hallonstaden",
                                             Country = "bärland",
                                             PostCode = "1111",
                                             CoAddress = "",
                                         },
                           Languages = new List<string> {"Svenska", "Engelska", "Gurka"},
                       };
        }

        public static DateTime GetImpedimentDocIssuedDate
        {
            get { return new DateTime(2018, 11, 01); }
        }

        public static Booking GetOrdinaryBooking()
        {
            var bookingDateTime = new DateTime(2019, 01, 01, 14, 0, 0);
            var preferredDate1 = new DateTime(2018, 12, 01);
            var preferredDate2 = new DateTime(2018, 12, 01);
            return new Booking
                       {
                MinisterCode = null,
                CeremonyType = CeremonyType.Ordinary,
                DateTime = new TimeBlock { StartDateTime = bookingDateTime },
                PreferredDate1 = preferredDate1,
                PreferredDate2 = preferredDate2,
            };
        }

        public static MinisterTimeBlock GetNewTimeBlock()
        {
            var bookingDateTime = new DateTime(2019, 01, 01, 14, 0, 0);
            return new MinisterTimeBlock
                       {
                           StartDateTime = bookingDateTime,
                           Interval = Convert.ToInt32(bookingDateTime.ToString("mm")) + 5,
                           TimeBlockStatus = TimeBlockStatus.Bookable,
                       };
        }
    }
}